Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x-pack/filebeat/input/entityanalytics/okta/internal: add role and factor client calls #41044

Merged
merged 4 commits into from
Oct 16, 2024

Conversation

efd6
Copy link
Contributor

@efd6 efd6 commented Sep 29, 2024

Proposed commit message

See title.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Disruptive User Impact

Author's Checklist

  • [ ]

How to test this PR locally

Requires an okta account to test. See header of test file for details.

Example redacted output excerpts from a test run:

=== RUN   Test/none/my_roles
{"log.level":"debug","@timestamp":"2024-09-30T08:28:17.132+0930","log.origin":{"function":"github.com/elastic/beats/v7/x-pack/filebeat/input/entityanalytics/provider/okta/internal/okta.getDetails[...]","file.name":"okta/okta.go","file.line":373},"message":"rate limit","limit":0.8323699233704588,"burst":1,"url":"https://REDACTEDADMINDOMAIN.okta.com/api/v1/users/REDACTEDUSER/roles","ecs.version":"1.6.0"}
{"log.level":"debug","@timestamp":"2024-09-30T08:28:18.357+0930","log.origin":{"function":"github.com/elastic/beats/v7/x-pack/filebeat/input/entityanalytics/provider/okta/internal/okta.oktaRateLimit","file.name":"okta/okta.go","file.line":453},"message":"rate limit header","X-Rate-Limit-Limit":"50","X-Rate-Limit-Remaining":"48","X-Rate-Limit-Reset":"1727650756","ecs.version":"1.6.0"}
{"log.level":"debug","@timestamp":"2024-09-30T08:28:18.357+0930","log.origin":{"function":"github.com/elastic/beats/v7/x-pack/filebeat/input/entityanalytics/provider/okta/internal/okta.oktaRateLimit","file.name":"okta/okta.go","file.line":495},"message":"rate limit adjust","set_rate":0.8327158626376382,"set_burst":1,"ecs.version":"1.6.0"}
    okta_test.go:141: roles: [{"id":"REDACTEDROLE","label":"Super Administrator","type":"SUPER_ADMIN","status":"ACTIVE","created":"REDACTEDDATE","lastUpdated":"2024-05-13T20:57:13Z","assignmentType":"USER","_links":{"assignee":{"href":"https://REDACTEDDOMAIN.okta.com/api/v1/users/REDACTEDUSER"}}}]

=== RUN   Test/none/my_factors
{"log.level":"debug","@timestamp":"2024-09-30T08:28:18.357+0930","log.origin":{"function":"github.com/elastic/beats/v7/x-pack/filebeat/input/entityanalytics/provider/okta/internal/okta.getDetails[...]","file.name":"okta/okta.go","file.line":373},"message":"rate limit","limit":0.8327158626376382,"burst":1,"url":"https://REDACTEDADMINDOMAIN.okta.com/api/v1/users/REDACTEDUSER/factors","ecs.version":"1.6.0"}
{"log.level":"debug","@timestamp":"2024-09-30T08:28:19.483+0930","log.origin":{"function":"github.com/elastic/beats/v7/x-pack/filebeat/input/entityanalytics/provider/okta/internal/okta.oktaRateLimit","file.name":"okta/okta.go","file.line":453},"message":"rate limit header","X-Rate-Limit-Limit":"50","X-Rate-Limit-Remaining":"47","X-Rate-Limit-Reset":"1727650756","ecs.version":"1.6.0"}
{"log.level":"debug","@timestamp":"2024-09-30T08:28:19.483+0930","log.origin":{"function":"github.com/elastic/beats/v7/x-pack/filebeat/input/entityanalytics/provider/okta/internal/okta.oktaRateLimit","file.name":"okta/okta.go","file.line":495},"message":"rate limit adjust","set_rate":0.8316150651486308,"set_burst":1,"ecs.version":"1.6.0"}
    okta_test.go:166: factors: [{"id":"REDACTEDFACTOR","factorType":"token:software:totp","provider":"OKTA","vendorName":"OKTA","status":"ACTIVE","created":"REDACTEDDATE","lastUpdated":"REDACTEDDATE","profile":{"credentialId":"REDACTEDLOGINID"},"_links":{"self":{"hints":{"allow":["GET","DELETE"]},"href":"https://REDACTEDDOMAIN.okta.com/api/v1/users/REDACTEDUSER/factors/REDACTEDFACTOR"},"user":{"hints":{"allow":["GET"]},"href":"https://REDACTEDDOMAIN.okta.com/api/v1/users/REDACTEDUSER"},"verify":{"hints":{"allow":["POST"]},"href":"https://REDACTEDDOMAIN.okta.com/api/v1/users/REDACTEDUSER/factors/REDACTEDFACTOR/verify"}}}]

Related issues

Use cases

Screenshots

Logs

@efd6 efd6 added enhancement Filebeat Filebeat Team:Security-Service Integrations Security Service Integrations Team labels Sep 29, 2024
@efd6 efd6 self-assigned this Sep 29, 2024
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Sep 29, 2024
Copy link
Contributor

mergify bot commented Sep 29, 2024

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @efd6? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit

Copy link
Contributor

mergify bot commented Sep 29, 2024

backport-8.x has been added to help with the transition to the new branch 8.x.
If you don't need it please use backport-skip label and remove the backport-8.x label.

@mergify mergify bot added the backport-8.x Automated backport to the 8.x branch with mergify label Sep 29, 2024
@efd6 efd6 force-pushed the i10462-entityanalytics_okta branch 2 times, most recently from b7e03ad to a3a0103 Compare September 29, 2024 23:31
@efd6 efd6 marked this pull request as ready for review September 30, 2024 01:29
@efd6 efd6 requested a review from a team as a code owner September 30, 2024 01:29
@elasticmachine
Copy link
Collaborator

Pinging @elastic/security-service-integrations (Team:Security-Service Integrations)

@@ -176,6 +207,48 @@ func GetUserDetails(ctx context.Context, cli *http.Client, host, key, user strin
return getDetails[User](ctx, cli, u, key, user == "", omit, lim, window, log)
}

// GetUserRoles returns Okta group roles using the groups API endpoint. host is the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

godoc needs changed for GetUserFactors.

Copy link
Contributor

mergify bot commented Oct 10, 2024

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b i10462-entityanalytics_okta upstream/i10462-entityanalytics_okta
git merge upstream/main
git push upstream i10462-entityanalytics_okta

@efd6 efd6 force-pushed the i10462-entityanalytics_okta branch from 80a1e75 to a5fd059 Compare October 10, 2024 19:52
Copy link
Contributor

mergify bot commented Oct 14, 2024

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b i10462-entityanalytics_okta upstream/i10462-entityanalytics_okta
git merge upstream/main
git push upstream i10462-entityanalytics_okta

@efd6 efd6 force-pushed the i10462-entityanalytics_okta branch from fede4c3 to 63b191d Compare October 14, 2024 23:16
Copy link
Contributor

mergify bot commented Oct 15, 2024

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b i10462-entityanalytics_okta upstream/i10462-entityanalytics_okta
git merge upstream/main
git push upstream i10462-entityanalytics_okta

@@ -72,6 +72,37 @@ type Group struct {
Profile map[string]any `json:"profile"`
}

// Role is an Okta identity factor description.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Role is an Okta identity factor description.
// Factor is an Okta identity factor description.

@efd6 efd6 force-pushed the i10462-entityanalytics_okta branch from 63b191d to 70c3e56 Compare October 16, 2024 04:20
@efd6 efd6 merged commit 10a2e94 into elastic:main Oct 16, 2024
20 of 22 checks passed
mergify bot pushed a commit that referenced this pull request Oct 16, 2024
belimawr pushed a commit to belimawr/beats that referenced this pull request Oct 18, 2024
efd6 added a commit that referenced this pull request Oct 22, 2024
efd6 added a commit that referenced this pull request Oct 23, 2024
…tor client calls (#41044) (#41251)

(cherry picked from commit 10a2e94)

Co-authored-by: Dan Kortschak <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify enhancement Filebeat Filebeat Team:Security-Service Integrations Security Service Integrations Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants